﻿#pragma once

#include "core/Macro.h"

namespace Engine
{
	/// <summary>
	/// 输入系统抽象
	/// </summary>
	class ENGINE_API AbstractInput
	{
	public:
		virtual ~AbstractInput() = default;

		inline static bool IsMouseButtonPressed(const int button) { return instance->IsMouseButtonImpl(button); }
		inline static float GetMouseX() { return instance->GetMouseXImpl(); }
		inline static float GetMouseY() { return instance->GetMouseYImpl(); }
		inline static std::pair<float, float> GetMousePosition() { return instance->GetMousePositionImpl(); }

		inline static bool IsKeyPressed(const int keyCode) { return instance->IsKeyPressedImpl(keyCode); }

	protected:
		virtual bool IsMouseButtonImpl(int button) = 0;
		virtual float GetMouseXImpl() = 0;
		virtual float GetMouseYImpl() = 0;
		virtual std::pair<float, float> GetMousePositionImpl() = 0;

		virtual bool IsKeyPressedImpl(int keyCode) = 0;

	private:
		static AbstractInput* instance;
	};
}
